﻿Imports DTO
Imports System.Data.SqlClient

Public Class CTChuyenKhoDAO
    'HuyBinh
    Public Shared Function LayMaPhieuChuyenKhoTuTang(sql As String) As Object
        Dim kq As Object
        kq = CKetNoi.ReturnVal(sql)
        Return kq
    End Function

    'HuyBinh
    Public Shared Function KiemTraSLHangTonTrongKho(hangTonKho As CTChuyenKhoDTO) As Object
        Dim kq As Object = CKetNoi.ReturnVal(String.Format("Exec usp_KiemTraSLHangTonTrongKho '{0}', '{1}'", hangTonKho.MaHangHoa, hangTonKho.TuKho))
        Return kq
    End Function

    Public Shared Function ThemChiTietPhieuCK(ct As CTChuyenKhoDTO) As Integer
        Dim dsThamSo As New List(Of SqlParameter)
        dsThamSo.Add(New SqlParameter("@MaPhieuCK", ct.MaPhieuChuyenKho))
        dsThamSo.Add(New SqlParameter("@MaHangHoa", ct.MaHangHoa))
        dsThamSo.Add(New SqlParameter("@MaDonVi", ct.MaDonVi))
        dsThamSo.Add(New SqlParameter("@SoLuong", ct.SoLuong))
        dsThamSo.Add(New SqlParameter("@DonGia", ct.DonGia))
        dsThamSo.Add(New SqlParameter("@TuKho", ct.TuKho))
        dsThamSo.Add(New SqlParameter("@DenKho", ct.DenKho))
        Dim kq As Integer = CKetNoi.ExecQueryStoreProc("usp_ThemChiTietChuyenKho", dsThamSo)
        Return kq
    End Function
End Class
